home *** CD-ROM | disk | FTP | other *** search
/ CyberMycha 2008 January / Cybermycha 1_2008.iso / Data.cab / _276F53BFBC3D43AA946FD4007ADA86D3 < prev    next >
Encoding:
Text File  |  2004-03-24  |  1.7 KB  |  61 lines

  1.  
  2. hlsl("
  3.  
  4. sampler Image: register(s0);
  5. sampler HatchTex: register(s1);
  6.  
  7. static const half4 H0 = {1, 0, 0, 0};
  8. static const half4 H1 = {0, 1, 0, 0};
  9. static const half4 H2 = {1, 1, 0, 0};
  10. static const half4 H3 = {0, 0, 1, 0};
  11. static const half4 H4 = {0, 0, 0, 1};
  12. static const half4 H5 = {0, 0, 1, 1};
  13. static const half4 H6 = {1, 1, 1, 1};
  14.  
  15. half4 main(half2 texCoord0: TEXCOORD0,
  16.              half2 texCoord1: TEXCOORD1) : COLOR {
  17.  
  18.  
  19.     half4 Color = tex2D( Image, texCoord0);
  20.     half4 AllHatch = tex2D( HatchTex, texCoord1);    
  21.     half  Lum = dot( Color.rgb, half3( 0.33, 0.33, 0.33))*4;
  22.     int step = Lum*8;
  23.  
  24.     half level0 = saturate(half(step)-0.875*8);
  25.     half hatch0 = 1 - AllHatch.x;     // 1-dot(AllHatch, H0);
  26.     half Hatch = lerp( hatch0, 1, level0 );
  27.     
  28.     half level1 = saturate(half(step)-0.75*8);
  29.     half hatch1 = 1- AllHatch.y;      // 1-dot(AllHatch, H1);
  30.     Hatch = lerp( hatch1, Hatch, level1 );
  31.  
  32.     half level2 = saturate(half(step)-0.625*8);
  33.     half hatch2 = 1-dot(AllHatch.xyz, H2.xyz);
  34.     Hatch = lerp( hatch2, Hatch, level2 );
  35.     
  36.     half level3 = saturate(half(step)-0.5*8);
  37.     half hatch3 = 1- AllHatch.z;    //1-dot(AllHatch, H3);
  38.     Hatch = lerp( hatch3, Hatch, level3 );
  39.  
  40.     half level4 = saturate(half(step)-0.375*8);
  41.     half hatch4 = 1- AllHatch.w;    //1-dot(AllHatch, H4);
  42.     Hatch = lerp( hatch4, Hatch, level4 );
  43.  
  44.     half level5 = saturate(half(step)-0.25*8);
  45.     half hatch5 = 1-dot(AllHatch, H5);    
  46.     Hatch = lerp( hatch5, Hatch, level5 );
  47.  
  48.     Color.rgb += Hatch;
  49.  
  50.     half level6 = saturate(half(step)-0.125*8);
  51. /*
  52.     half hatch6 = 1-dot(AllHatch, H6);    
  53.     Color.rgb = lerp( hatch6, Color.rgb, level6 );
  54. */    
  55.     Color.rgb *= saturate(level6);
  56.     return Color;
  57. }
  58.  
  59. ")
  60.  
  61.